﻿<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/test.jsp" %>
<%
  // *** Validate request to log in to this site.
  String MM_LoginAction = request.getRequestURI();
  if (request.getQueryString() != null && request.getQueryString().length() > 0) {
    String queryString = request.getQueryString();
    String tempStr = "";
    for (int i = 0; i < queryString.length(); i++) {
      if (queryString.charAt(i) == '<') tempStr = tempStr + "&lt;";
      else if (queryString.charAt(i) == '>') tempStr = tempStr + "&gt;";
      else if (queryString.charAt(i) == '"') tempStr = tempStr + "&quot;";
      else tempStr = tempStr + queryString.charAt(i);
    }
    MM_LoginAction += "?" + tempStr;
  }
  String MM_valUsername = request.getParameter("username");
  if (MM_valUsername != null) {
    String MM_fldUserAuthorization = "";
    String MM_redirectLoginSuccess = "loginok.jsp";
    String MM_redirectLoginFailed = "loginFail.jsp";
    String MM_redirectLogin = MM_redirectLoginFailed;
    Driver MM_driverUser = (Driver) Class.forName(MM_test_DRIVER).newInstance();
    Connection MM_connUser = DriverManager.getConnection(MM_test_STRING, MM_test_USERNAME, MM_test_PASSWORD);
    String MM_pSQL = "SELECT studentID, password";
    if (!MM_fldUserAuthorization.equals("")) MM_pSQL += "," + MM_fldUserAuthorization;
    MM_pSQL += " FROM shengwuyixue.student WHERE studentID=\'" + MM_valUsername.replace('\'', ' ') + "\' AND password=\'" + request.getParameter("textfield2").toString().replace('\'', ' ') + "\'";
    PreparedStatement MM_statementUser = MM_connUser.prepareStatement(MM_pSQL);
    ResultSet MM_rsUser = MM_statementUser.executeQuery();
    boolean MM_rsUser_isNotEmpty = MM_rsUser.next();
    if (MM_rsUser_isNotEmpty) {
      // username and password match - this is a valid user
      session.putValue("MM_Username", MM_valUsername);
      if (!MM_fldUserAuthorization.equals("")) {
        session.putValue("MM_UserAuthorization", MM_rsUser.getString(MM_fldUserAuthorization).trim());
      } else {
        session.putValue("MM_UserAuthorization", "");
      }
      if ((request.getParameter("accessdenied") != null) && false) {
        MM_redirectLoginSuccess = request.getParameter("accessdenied");
      }
      MM_redirectLogin = MM_redirectLoginSuccess;
    }
    MM_rsUser.close();
    MM_connUser.close();
    response.sendRedirect(response.encodeRedirectURL(MM_redirectLogin));
    return;
  }
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>北京交通大学计算机与信息技术学院生物医学工程系</title>
  <link href="<%=request.getContextPath()%>/include/css/css.css" rel="stylesheet" type="text/css"/>
  <style type="text/css">
    <!--
    .STYLE1 {
      font-size: 16px;
      font-weight: bold;
    }

    .STYLE3 {
      font-size: 18px;
      font-weight: bold;
    }

    .STYLE4 {
      color: #006633;
      font-size: 18px;
    }

    .STYLE5 {
      color: #000000
    }

    .STYLE6 {
      font-size: 16px
    }

    .login {
      font-family: "新宋体";
      font-size: 16px;
      color: #999966;
      background-color: #FFFFCC;
    }

    .STYLE7 {
      font-size: 14px
    }

    .STYLE10 {
      color: #FFFFFF
    }

    .STYLE11 {
      font-size: 16
    }

    -->
  </style>
  <script type="text/JavaScript">
    <!--
    function MM_goToURL() { //v3.0
      var i, args = MM_goToURL.arguments;
      document.MM_returnValue = false;
      for (i = 0; i < (args.length - 1); i += 2) eval(args[i] + ".location='" + args[i + 1] + "'");
    }
    //-->
  </script>
</head>
<body>
<div class="zhong">

  <jsp:include page="/include/banner.jsp"/>
  <jsp:include page="/include/menu.jsp"/>

  <div class="main">
    <div class="left">
      <div class="box_1">
        <div class="left_title STYLE1">本系新闻公告</div>
        <div class="left_news">
          <ul>
            <li><a href="#" class="hover">本系新闻</a></li>

            <li><a href="b_inform.jsp">本科生通知</a></li>
            <li><a href="y_inform.jsp">研究生通知</a></li>
          </ul>
        </div>
      </div>

      <div class="box_1" style="margin:0px;">
        <div class="left_title STYLE1">信息服务</div>
        <div class="left_nr">
          <ul>
            <li><a href="register.jsp">系统注册</a></li>
            <li><a href="register.jsp">完成登录</a></li>
            <li><a href="adminlogin/login.jsp">后台管理</a></li>


          </ul>
        </div>
      </div>
    </div>
    <div class="right">
      <div class="right_title">
        <p class="STYLE4 STYLE5">本系简介</p>
        <hr/>
        <p align="center" class="STYLE6">您好，请您键入登录信息！</p>
        <form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
          <p align="center" class="STYLE6">&nbsp;</p>
          <table width="50%" border="0" align="center" cellspacing="0" bgcolor="#005998">
            <tr>
              <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
              <td width="22%" class="login1"><span class="login1">用户名：</span></td>
              <td width="78%"><input name="username" type="text" class="login" id="username"/></td>
            </tr>
            <tr>
              <td class="login1"><span class="STYLE10">密码：</span></td>
              <td><input name="textfield2" type="password" class="login" value=""/></td>
            </tr>
            <tr>
              <td colspan="2"><p>&nbsp;</p>
                <p align="center">
                  <input type="submit" name="Submit" value="登录"/>
                  &nbsp;
                  <input name="Submit2" type="button"
                         onclick="MM_goToURL('parent','register.jsp');return document.MM_returnValue" value="注册"/>
                </p>
                <p>&nbsp; </p></td>
            </tr>
          </table>
        </form>
        <p align="center" class="STYLE6">&nbsp;</p>
        <p class="STYLE4">&nbsp;</p>
        <p class="STYLE4">&nbsp;</p>
        <p class="STYLE4">&nbsp;</p>
        <p class="STYLE4">&nbsp;</p>
      </div>
    </div>
    <!--这里是链接模块-->
    <div class="clear"></div>
    <div class="huoban">
      <div class="huoban_title STYLE7">友情链接</div>
      <div class="huoban_nr">
        <ul>
          <li class="STYLE11">北京交通大学计算机与信息技术学院</li>
          <li class="STYLE11">北京交通大学主页</li>
          <li class="STYLE11">北京交通大学知行论坛</li>
          <li class="STYLE11">北京交通大学图书馆</li>
          <li></li>
          <li></li>
        </ul>
        <div class="clear"></div>
      </div>
    </div>
    <div class="clear"></div>
  </div>


  <div class="clear"></div>
</div>
<div class="bottom">
  <p>地址：北京市海淀区上园村3号北京交通大学信息中心　邮编：100044　 </p>
  <p>北京交通大学计算机与信息技术学院生物医学工程系保留网站所有权利</p>
  <p> 未经允许不得复制、镜像</p>
  <p>京公网安备：110402430059 号</p>
  <br/>
  版权所有&copy;ouchanghai,cit.bjtu.
</div>
</div>
<script src="<%=request.getContextPath()%>/include/js/meun.js" type="text/javascript"></script>
</body>
</html>
